package team.knowers.qzh.qzhserver.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import team.knowers.qzh.qzhserver.common.convention.result.Result;
import team.knowers.qzh.qzhserver.common.convention.result.Results;
import team.knowers.qzh.qzhserver.dto.req.SearchReqDTO;
import team.knowers.qzh.qzhserver.dto.resp.CourseSearchRespDTO;
import team.knowers.qzh.qzhserver.dto.resp.UserSearchRespDTO;
import team.knowers.qzh.qzhserver.service.SearchService;

import java.util.List;

@RequiredArgsConstructor
@RestController
public class SearchController {
    private final SearchService searchService;
    @GetMapping("/api/qzh-server/admin/v1/search/user")
    public Result<List<UserSearchRespDTO>> listUserInfo(@RequestBody SearchReqDTO reqDTO) {
        return Results.success(searchService.listUserInfo(reqDTO));
    }
    @GetMapping("/api/qzh-server/admin/v1/search/course")
    public Result<List<CourseSearchRespDTO>> listCourseInfo(@RequestBody SearchReqDTO reqDTO)
    {
        return Results.success(searchService.listCourseInfo(reqDTO));
    }

}
